jas.plugin
Class Plugin

java.lang.Object
  |
  +--jas.plugin.BasicPlugin
        |
        +--jas.plugin.Plugin
All Implemented Interfaces:
IPlugin

public abstract class Plugin
extends BasicPlugin
implements IPlugin

Support for Java Analysis Studio Job Plugins The Plugin class is used to extend the functionality of Java Analysis Studio with experiment, group, or personal extensions. Java Analysis Studio plugins extend the Plugin class in a similar manner that web applets extend Applet. Plugins are a little more flexible than web applets however, since plugins can add new items to the Java Analysis Studio menu, create windows in the main body of the application, and interact with event data.

A typical use for a plugin would be to provide an experiment specific event display within the body of the Java Analysis Studio application.

The current plugin functionality is fairly limited, more will be added in later releases. Send suggestions for improved functionality to jas-feedback@sld-mail.slac.stanford.edu

Note: Most of the methods of Plugin require a context, and therefore should not be called before the Plugin is initialized (i.e. its init() method is called).

See Also:
ExtensionPlugin

Fields inherited from class jas.plugin.BasicPlugin
out
 
Constructor Summary
Plugin()
           
 
Method Summary
 void addRunListener(RunListener listener)
          A plugin can use this method if it wants to be informed about changes in run state.
 void destroy()
          Called by the application when the plugin is destroyed typically when the job containing the plugin is closed.
 EventData getCurrentEvent()
          Fetch the current event, as returned by the current EventSource This method is rather crude, especially in the case of a remote job, since it fetches the entire event over the network (which also implies that the event must be serializable).
 PluginContext getPluginContext()
          Provides access to the PluginContext.
 void removeRunListener(RunListener listener)
          Remove a run listener previously added using addRunListener
 void sendJob(java.lang.Object message)
          The plugin can call this method to send a message to the Job.
 void setPluginContext(PluginContext context)
          Called by the application before the plugins init method is called, to install the PluginContext
 
Methods inherited from class jas.plugin.BasicPlugin
addMenu, error, error, init, installConsole, installControl, installPage, removeMenu, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Plugin

public Plugin()
Method Detail

setPluginContext

public void setPluginContext(PluginContext context)
Called by the application before the plugins init method is called, to install the PluginContext
Specified by:
setPluginContext in interface IPlugin

getPluginContext

public PluginContext getPluginContext()
Provides access to the PluginContext. It is better to use the many utility methods in Plugin rather than accessing the PluginContext directly.

addRunListener

public void addRunListener(RunListener listener)
A plugin can use this method if it wants to be informed about changes in run state. Event Displays typically install a RunListener so that they know when to display a new event
Parameters:
listener - The RunListener to add

removeRunListener

public void removeRunListener(RunListener listener)
Remove a run listener previously added using addRunListener
Parameters:
listener - The RunListener to be removed
See Also:
addRunListener(RunListener)

getCurrentEvent

public EventData getCurrentEvent()
                          throws NoEventAvailable
Fetch the current event, as returned by the current EventSource This method is rather crude, especially in the case of a remote job, since it fetches the entire event over the network (which also implies that the event must be serializable). Some better mechanism of interacting with remote events will be provided in future.
Returns:
The current event, as returned by the current EventSource's getNextEvent method
Throws:
NoEventAvailable - if there is no current event, or if the current event cannot be fetched (because it is remote and not serializable).

sendJob

public void sendJob(java.lang.Object message)
The plugin can call this method to send a message to the Job. This will result in the Job's messageReceived method being called. Note that if the job is a remote job, the message must implement java.io.Serializable or it won't get to the remote server.
Parameters:
message - The message to send
See Also:
HistogramServer.addMessageListener(jas.server.MessageListener)

destroy

public void destroy()
Called by the application when the plugin is destroyed typically when the job containing the plugin is closed.
Specified by:
destroy in interface IPlugin